<!DOCTYPE html>

<head>
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <!-- import Vue before Element -->
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
  <!-- import element-ui JavaScript -->
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <div id="app">
    <el-input v-model="val" placeholder="" @change="onchange($event,1)"></el-input>
  </div>

</head>


<script>
  var demo = new Vue({
    el: "#app",
    data() {
      return {
        val: "",
        // orgData: [
        //   { ID: "DB0D5FCD-55B3-43CA-AC60-5824595945D7", Name: "房建专项设备", Num: "01", Code: "01", ParentId: "00000000-0000-0000-0000-000000000000" },
        //   { ID: "269CAEB2-ADA2-43A1-A77C-A7FDA33154B8", Name: "地基基础", Num: "03", Code: "103", ParentId: "DB0D5FCD-55B3-43CA-AC60-5824595945D7" },
        //   { ID: "7E252277-187F-492F-8A43-DFF0D5F2F248", Name: "电动液压千斤顶", Num: "02", Code: "10302", ParentId: "269CAEB2-ADA2-43A1-A77C-A7FDA33154B8" },
        //   { ID: "C27E6010-9B4E-4779-9C8F-73D41DB21FF5", Name: "电动液压千斤顶（5000kN）", Num: "01", Code: "1030201", ParentId: "7E252277-187F-492F-8A43-DFF0D5F2F248" }
        // ],
        a: 2,
        data: [],
        defaultProps: {
          label: 'Name',
          children: 'children'
        }
      };
    },

    computed: {
      total() {
        return this.a * 5
      }

    },
    mounted() {

    },

    methods: {
      onchange(e, t) {
        console.log("onchange($event,1)")
        console.log(e, t)
      },
      handleNodeClick(data) {
        console.log(data);
        this.$nextTick(() => {
          // this.$refs.etr.setCurrentKey("DB0D5FCD-55B3-43CA-AC60-5824595945D7")
        })
      },
      loadNode(node, resolve) {

        if (node.level === 0) {
          return resolve(this.getChildren());
          // return resolve([{ name: 'region1' }, { name: 'region2' }]);
        }
        console.log(node.data.Name)
        return resolve(this.getChildren(node.data.ID));
      },
      getChildren(pid) {

        if (!pid) {
          return [{ ID: "DB0D5FCD-55B3-43CA-AC60-5824595945D7", Name: "房建专项设备", Num: "01", Code: "01", ParentId: "00000000-0000-0000-0000-000000000000" }]
        } else if (pid == "DB0D5FCD-55B3-43CA-AC60-5824595945D7") {
          return [
            { ID: "269CAEB2-ADA2-43A1-A77C-A7FDA33154B8", Name: "地基基础", Num: "03", Code: "103", ParentId: "DB0D5FCD-55B3-43CA-AC60-5824595945D7" },
          ]
        } else if (pid == "269CAEB2-ADA2-43A1-A77C-A7FDA33154B8") {
          return [
            { ID: "7E252277-187F-492F-8A43-DFF0D5F2F248", Name: "电动液压千斤顶", Num: "02", Code: "10302", ParentId: "269CAEB2-ADA2-43A1-A77C-A7FDA33154B8" },
          ]
        } else if (pid == "7E252277-187F-492F-8A43-DFF0D5F2F248") {
          return [
            { ID: "C27E6010-9B4E-4779-9C8F-73D41DB21FF5", Name: "电动液压千斤顶（5000kN）", Num: "01", Code: "1030201", ParentId: "7E252277-187F-492F-8A43-DFF0D5F2F248" }
          ]
        }
      }
    }
  });
</script>